package top.yxqz.filter.demo;

import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @author Mr.余
 * @date 2022/12/6
 * @package top.yxqz.filter.demo
 * 评论的servlet
 */
@WebServlet("/comment")
public class CommentServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        this.doPost(request, response);
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String comment = request.getParameter("comment");//获取前端参数
//        ServletContext servletContext = getServletContext();//得到application域对象
//        servletContext.setAttribute("comment",comment); //将数据丢到域里面去
        request.getRequestDispatcher("/bootstrapdemo.jsp").forward(request,response);
    }
}
